package com.fsc.fragment;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
/**
 * 数据库操作的帮助类
 * @author fsc
 *
 */

public class DBHelper extends SQLiteOpenHelper {

	public DBHelper(Context context) {
		super(context, "FFManagement.db", null, 1);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		Log.i("TAG", "DBHelper onCreate()");
		//创建收入表表
		db.execSQL("create table InCome(_id integer primary key autoincrement,"
									  + "money double,"
									  + "time varchar(10),"
									  + "type varchar(10),"
									  + "handler varchar(100),"
									  + "mark varchar(200))"
				);
		
		//创建支出表
		db.execSQL("create table OutCome(_id integer primary key autoincrement,"
									  + "money double,"
									  + "time varchar(10),"
									  + "type varchar(10),"
									  + "address varchar(100),"
									  + "mark varchar(200))"
						);
		//创建密码表
		db.execSQL("create table Password(_id integer primary key autoincrement,name varchar(20))");
		
		//创建便签表
		db.execSQL("create table Flag(_id integer primary key autoincrement,flag varchar(200),time varchar(10))");
	}
	//当数据库版本更新是调用此方法
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
	}
}
